#include"processBar.h"
#define END "\033[m"
#define BLUE "\033[0;32;34m"
char arr[NUM]={0};

const char ch[]="|-/\\";

void processbar(int rate)
{
    if(rate <0 || rate > 100) return;
    int len = sizeof(ch);;
    
        printf(BLUE"[%-100s][%d%%]%c\r"END,arr,rate,ch[rate%len]);
        fflush(stdout);
       arr[rate++] = CH;
       if(rate <100) arr[rate] = '>';
}




//v1
//void processBar(int seppd)
//{
//    int len = sizeof(ch);
//    int cnt = 0;
//    while(cnt<=TOP)
//    {
//        printf("[%-100s][%d%%]%c\r",arr,cnt,ch[cnt%len]);
//        fflush(stdout);
//       arr[cnt++] = CH;
//        usleep(100000);
//    }
//    printf("\n");
//}
